Repository navigation
fix(daemon-client): clear remote URL and token on timeout once response starts or /health answers - #5044
Conversation
|
Thanks for the fix. The code at 0ed6ea4 is ready. Not blocking, and fine to take or leave: the /health probe adds 17 lines to daemon-client-transport.ts, which is why lint fails (see below); the JSDoc at https://github.com/callstack/agent-device/blob/0ed6ea4/packages/daemon-client/src/daemon-client-transport.ts#L431 says a wrong token is refused at once, but /health does not check the token and only /rpc refuses it, so the comment and PR body could say that; no test pins the 1 s bound on the post-timeout /health, so one row where the stand-in holds the second connection open and asserts remoteHealthAnswered is false in under about 2 s would cover it; the remote hint in https://github.com/callstack/agent-device/blob/0ed6ea4/packages/daemon-client/src/daemon-client-timeout.ts#L236 repeats the canceled/prepare wording of the local tail and gives snapshot no prepare advice, which suits a follow-up issue; and answersRemoteHealth accepts any 2xx, so it could also require the daemon service field when set. The "Lint, Typecheck & Package" check fails in oxlint with "File has too many lines (1004)" on daemon-client-transport.ts, and the PR causes it: the file is 987 lines on main and 1004 once this change lands, against a limit of 1000. No conflicts. Before merge, move the post-timeout /health probe out of that file (for example next to the timeout and liveness code) without a lint exemption, then re-run the cancelled Body rules checks. Not verified here: a live run against a real remote daemon or tunnel, cancel-on-disconnect through a reverse proxy or gateway (it was traced only on the direct daemon HTTP server), the claim that the client has no typed runner-startup signal, and the vitest suites locally (CI ran them). |
0ed6ea4 to
5d77193
Compare
|
|
Thanks for the update. The earlier review at 0ed6ea4 found no code problems, and 5d77193 keeps it that way. The file-length lint failure from 0ed6ea4 is fixed: the lint job now passes at 994 lines. CI is green. The only check not passing is Body rules, which was cancelled (not failed) when the rebase and force-push replaced the run. It exercises no code route. There are no conflicts. Re-running that check is the only step left before merge. Not verified here: a live run against a real remote daemon or tunnel, and cancel-on-disconnect through a reverse proxy or gateway (the earlier trace covered the direct daemon HTTP server only). A local vitest re-run was also not done, since CI ran the suites at this head. The claim that raising the probe bound to 3 s fails the bound test was reasoned from the code, not run. |
|
Cancel-on-disconnect, checked with the real daemon HTTP server and the real
So in 40015cc, when |
|
Thanks for the update. The code at 40015cc looks good, and the earlier review of 5d77193 still holds with no new findings. The only check not passing is Body rules, which was cancelled by a newer push rather than failed, and it covers the PR title and body, not packages/daemon-client. Please re-run it before merge. Not verified here: the proxy cancel-on-disconnect measurement was only cross-read against daemon-proxy.ts, the new route test row was judged from the code without a mutation run, and whether a third-party reverse proxy in front of a bare daemon forwards the disconnect. The base did not retry on any route, so that last case is not a regression. No conflicts. |
|
This branch now conflicts with main. Please rebase onto current main; the next review only checks that the rebase keeps the reviewed change intact. |
|
Thanks for the reproduction. Two changes would make this smaller now that #5058 is merged:
The branch also needs a rebase onto current main. |
…se starts or /health answers
40015cc to
547b406
Compare
|
Rebased onto
|
|
Thanks for the rework. No code issues remain at 547b406: the conflict from the earlier review is resolved, the proxy branch and Not verified here: no local tests or mutation runs were done, the live measurement of direct and proxied The only check not passing is Body rules, which was cancelled by a newer push and checks the PR title and body, so it is likely unrelated to this code. It needs a re-run before merge. |
Summary
Closes #5004.
Every remote timeout blamed the URL and auth token, even when the daemon was only slow, such as a first iOS
openstarting the XCTest runner past the 90 s window.When a sent remote request times out:
/rpc, that proves URL and token with no extra request (details.remoteResponseStarted: true).--json, MCP, and the SDK, or a stream with no progress yet), the client probes/healthonce (1 s cap) requiring a 2xx with a contract daemon or proxyservice(details.remoteHealthAnswered)./healthchecks no token, but/rpcrejects a wrong one immediately, so a timed-out request passed it.With either proof, the hint clears the URL and token. For
open, it notes the daemon canceled the open (directly and throughagent-device-proxyafter #5058), so retrying is safe; Apple platforms also name runner startup andprepare ios-runner. Other commands point to remote host logs. No proof or an unsent request keeps the old hint.Before / after
open com.apple.Preferences --platform iosagainst a remote daemon emittingStarting XCTest runner...until canceled:Validation
Head
547b40627(rebased onto9f7751eeb).check:affected --base upstream/main --run --head 547b40627: format, lint, typecheck, layering, fallow, build, and vitest-related pass;check:daemon-wire-compat(0 changed),check:doc-links, andcheck:doc-prosepass.vitest run --project unit-coreonpackages/daemon-client/src/: 416 passed; 19/19 mutants killed.